<!doctype html>
{php}
    $static = '/static/home/';
{/php}
<!--[if IE 7]> <html lang="en" class="ie7"> <![endif]-->
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
    <meta charset="utf-8" />
    <title>{$siteConfig['seo_title']}</title>
    <meta name="apple-mobile-web-app-title" content="{$siteConfig['seo_title']}">
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,width=device-width">
    <link rel="shortcut icon" href="{$static}images/favicon.ico">
    <link href="{$static}libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/app.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/style.css" rel="stylesheet" type="text/css" />
</head>
<body data-sidebar="dark">
<style type="text/css">
    table tr td {
        vertical-align:middle !important;
    }
</style>
<!-- Begin page -->
<div id="layout-wrapper">

    {include file='public/mine_topbar' /}
    {include file='public/mine_left' /}

    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="main-content">

        <div class="page-content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <p class="card-title-desc">当前最多展示1000条数据，如果检索当天，起始时间：2020-05-08 结束时间：2020-05-08</p>
                                <form action="{:url('order/index')}">
                                <div class="row mb-2">
                                    <div class="col-xl-3 col-md-6 padding-5">
                                        起始时间：<input type="text" class="form-control" id="startDate" name="startDate"
                                                    value="{$params['startDate']}" placeholder="请输入起始时间">
                                    </div>
                                    <div class="col-xl-3 col-md-6 padding-5">
                                        结束时间：<input type="text" class="form-control" id="endDate" name="endDate"
                                                    value="{$params['endDate']}" placeholder="请输入结束时间">
                                    </div>
                                    <div class="col-xl-3 col-md-6 padding-5">
                                        短链接：<input type="text" class="form-control" name="keyword"
                                                      value="{$params['keyword']}" placeholder="请输入短链接">
                                    </div>
                                    <div class="col-xl-3 col-md-6 padding-5">
                                        原始链接：<input type="text" class="form-control" name="link"
                                                    value="{$params['link']}" placeholder="请输入原始链接">
                                    </div>
                                    <div class="col-xl-3 col-md-6 padding-5">
                                        状态：
                                        <select class="form-control custom-select" name="sort">
                                            <option value="create_time" {if condition="$params['sort'] eq 'create_time'"}selected="selected" {/if}>创建时间</option>
                                            <option value="clicks" {if condition="$params['sort'] eq 'clicks'"}selected="selected" {/if} >访问量</option>
                                        </select>　
                                    </div>

                                    <div class="col-xl-1 col-md-6 padding-5">　　　　
                                        <input type="submit" class="btn btn-primary btn-block" value="搜索"/>
                                    </div>
                                    <div class="col-xl-1 col-md-6 padding-5">　　　　
                                        <a class="btn btn-danger btn-block" href="{:url('order/index')}">清空</a>
                                    </div>
                                </div>
                                </form>

                                <!-- table展示列表 -->
                                <div class="table-responsive pb-5">
                                    <!--<table id="datatable" class="table table-striped table-bordered">-->
                                        <table id="datatable" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                                        <thead>
                                        <tr>
                                            <td>编号</td>
                                            <td>订单编号</td>
                                            <td>充值用户id</td>
                                            <td>充值金额</td>
                                            <td>支付方式</td>
                                            <td>订单状态</td>
                                            <td>备注</td>
                                            <td>创建时间</td>
                                        </tr>
                                        </thead>

                                        <tbody>
                                        {empty name="list"}
                                        <tr>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                            <td>----</td>
                                        </tr>
                                        {else /}
                                        {foreach name="list" item="vo"}
                                        <tr>
                                            <td>{$key+1}</td>
                                            <td>{$vo.rechargeNo}</td>
                                            <td>{$vo.accountName}</td>
                                            <td>{$vo.totalAmount}</td>
                                            <td>银商代充</td>
                                            <td>
                                                {switch $vo.status }
                                                    {case 0}<span class="color-red">充值失败</span>{/case}
                                                    {case 1}<span class="color-green">充值成功</span>{/case}
                                                {/switch}
                                            </td>
                                            <td>{$vo.remark}</td>
                                            <td>{$vo.createTime}</td>
                                        </tr>
                                        {/foreach}
                                        {/empty}
                                        </tbody>
                                    </table>
                                </div><!-- table-responsive End -->

                                {notempty name="$pagination"}
                                <div class="col-lg-12">
                                    <div class="page">
                                        {:$pagination}
                                    </div>
                                </div>
                                {/notempty}
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->

            </div> <!-- container-fluid -->
        </div>
        <!-- End Page-content -->
    </div>
    <!-- end main content-->

</div>
<!-- END layout-wrapper -->

<!-- JAVASCRIPT -->
<script src="{$static}libs/jquery/jquery.min.js"></script>
<script src="{$static}libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="{$static}libs/metismenu/metisMenu.min.js"></script>
<script src="{$static}libs/simplebar/simplebar.min.js"></script>
<script src="{$static}libs/node-waves/waves.min.js"></script>
<script src="{$static}libs/layer/layer.js"></script>

<!-- Required datatable js -->
<script src="{$static}libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="{$static}libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="{$static}libs/rolldate/rolldate.min.js"></script>

<script type="text/javascript" src="{$static}js/app.js"></script>
<script type="text/javascript">
    $(function () {
        $("#datatable").DataTable({
            searching:false
        });

        //时间选择器
        new Rolldate({
            el: '#startDate',
            format: 'YYYY-MM-DD',
            beginYear: 2019,
            endYear: 2100
        });
        new Rolldate({
            el: '#endDate',
            format: 'YYYY-MM-DD',
            beginYear: 2019,
            endYear: 2100
        });

        setTimeout(function () {
            $.ajax({
                url: "{:url('order/getBalance')}",
                type: "POST",
                data: $("#form").serialize(),
                dataType: 'json',
                async: true,
                success: function (res) {
                    if(!res.errorCode) {
                        return false;
                    }
                    if (res.errorCode === 200) {
                        $('#balance').text(res.data.balance);
                    } else {
                        layer.alert(res.message, {
                            title: '提示',
                            icon: 2
                        });
                    }
                }
            });
        }, 500);
    });
</script>
</body>
</html>
